export function debounce(func: Function, wait: number) {
  let timeout: number; // 用于保存定时器ID

  return function (...args: any) {
    // @ts-ignore
    const context = this;

    clearTimeout(timeout); // 清除之前的定时器

    timeout = setTimeout(function () {
      func.apply(context, args);
    }, wait);
  };
}
